package com.dongdongshop.util;
import java.io.Serializable;
import java.util.List;
/**
 * @Description
 * @ClassName ItemCatController
 * @Author RC
 * @date 2020.12.11 15:39
 */
public class PageUtil<T> implements Serializable {
    private static final long serialVersionUID = 5099081648459347351L;
    private Integer pageNumber;
    private Integer pageSize;
    private Integer pages;
    //总页数
    private Integer startPage;
    //起始页
    private long total;
    // 总条数
    private List<T> list;

    public PageUtil() {
    }

    public PageUtil(Integer pageNumber, Integer pageSize,  long total, List<T> list) {
        this.pageNumber = pageNumber;
        this.pageSize = pageSize;
        this.total = total;
        this.list = list;
    }

    public Integer getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Integer getPages() {
        return (int)(total%pageSize == 0?total/pageSize:total/pageSize+1);
    }

    public void setPages(Integer pages) {
        this.pages = pages;
    }

    public Integer getStartPage() {
        return  (pageNumber -1)*pageSize;
    }

    public void setStartPage(Integer startPage) {
        this.startPage = startPage;
    }

}
